﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using YW.Common;
using LTP.Accounts.Bus;
namespace YW.Web.YWXT.YW_xfjlmxb
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(this.txtxfxm.Text.Trim().Length==0)
			{
				strErr+="消费项目不能为空！\\n";	
			}
			if(!PageValidate.IsDecimal(txtje.Text))
			{
				strErr+="金额格式错误！\\n";	
			}
			if(this.txtyypzbzj.Text.Trim().Length==0)
			{
				strErr+="用友凭证表主键不能为空！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			string xfxm=this.txtxfxm.Text;
			decimal je=decimal.Parse(this.txtje.Text);
			string yypzbzj=this.txtyypzbzj.Text;

			YW.Model.YWXT.YW_xfjlmxb model=new YW.Model.YWXT.YW_xfjlmxb();
			model.xfxm=xfxm;
			model.je=je;
			model.yypzbzj=yypzbzj;

			YW.BLL.YWXT.YW_xfjlmxb bll=new YW.BLL.YWXT.YW_xfjlmxb();
			bll.Add(model);
			YW.Common.MessageBox.ShowAndRedirect(this,"保存成功！","add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
